<?php
require_once('../../config.php');
Doctrine::loadModels('../../models');

if( $_GET["currency_id"]) // AND $_GET["category_id"] AND $_GET["item_desc"] AND $_GET["item_value"])
{
    $currency_id = strip_tags($_GET["currency_id"]);
    $date_start = strip_tags($_GET["date_start"]);
	$date_end = strip_tags($_GET["date_end"]);
	$exchange_rate = strip_tags($_GET["exchange_rate"]);
	$source_id = strip_tags($_GET["source_id"]);
	
	file_put_contents  ( "params_update.txt", 
								"currency_id '" .$currency_id.
								"' date_start '" .$date_start.
								"' date_end '" .$date_end.
								"' exchange_rate '" .$exchange_rate.
								"' source_id '" .$source_id."'");
	 
	//Update Direct to database with SQL until Doctrine issue resolved
	$db_query = sprintf("UPDATE fin_exchange_rates 
							SET currency_id='".$currency_id."',
								date_start='".$date_start."',
								date_end='".$date_end."'
								exchange_rate='".$exchange_rate."'
							WHERE source_id='".$source_id."'");
 
 	file_put_contents  ( "update_statement.txt", $db_query);   
 
 	$result = mysql_query($db_query);
    	if (!$result) {
        		die('invalid query');    // . mysql_error());
    		}
}

mysql_free_result( $result )

?>